@echo off
setlocal enabledelayedexpansion

echo ==========================================
echo Docker Desktop Startup Script
echo ==========================================

echo.
echo Starting Docker Desktop...
echo.

REM Check if Docker Desktop is installed
where "C:\Program Files\Docker\Docker\Docker Desktop.exe" >nul 2>&1
if %errorlevel% neq 0 (
    echo Error: Docker Desktop not found
    echo Please install Docker Desktop first: https://www.docker.com/products/docker-desktop/
    pause
    exit /b 1
)

REM Start Docker Desktop
echo Starting Docker Desktop...
start "" "C:\Program Files\Docker\Docker\Docker Desktop.exe"

echo.
echo Docker Desktop is starting, please wait...
echo After startup, you can run the following command to test:
echo   .\test_linux_build.bat
echo.
echo Or run Linux build directly:
echo   .\quick_linux_build.bat
echo.

REM Wait for Docker service to start
echo Waiting for Docker service to start...
timeout /t 30 /nobreak >nul

REM Test Docker connection
echo Testing Docker connection...
docker info >nul 2>&1
if %errorlevel% equ 0 (
    echo.
    echo ==========================================
    echo Docker Desktop started successfully!
    echo ==========================================
    echo.
    echo Now you can run Linux build script:
    echo   .\quick_linux_build.bat
    echo.
) else (
    echo.
    echo Docker service may still be starting, please try again later
    echo Or manually check Docker Desktop status
)

pause 